package com.asiainfo.dacp.datastash.domain.inter.repos;


import com.asiainfo.dacp.datastash.domain.inter.models.DataStashUnitInter;
import com.asiainfo.dacp.datastash.orm.dao.inter.DataStashUnitInterDao;
import com.asiainfo.dacp.datastash.orm.po.inter.DataStashUnitInterPo;
import com.asiainfo.dacp.datastash.orm.po.inter.pk.DataStashUnitInterPoPK;
import com.asiainfo.dacp.util.BeanConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class DataStashUnitInterRepository {

    @Autowired
    private DataStashUnitInterDao interDao;

    public DataStashUnitInter save(DataStashUnitInter inter){
        DataStashUnitInterPo unitInter= interDao.findList(inter.getUnitCode(),inter.getUnitProcId(),inter.getOper());
        if(unitInter==null){
            DataStashUnitInterPo po= new DataStashUnitInterPo(new DataStashUnitInterPoPK(inter.getUnitProcId(),inter.getOper()),inter.getUnitCode());
            interDao.save(po);
        }
        return  inter;
    }
}
